#ifndef REST_H
#define REST_H

#include "apibase.h"

class REST : public QObject {
    Q_OBJECT
public:
    explicit REST(QObject* parent = nullptr);
    virtual ~REST();

    void setRESTJson(const QByteArray &json);
    void start();
    void stop();

private:
    void parseRESTArray(QJsonArray & jsonProfileArray);
    void parseRESTObj(QJsonObject & jsonObj);

    void startRESTMethod(QString url, QString method, QString paramsStr,int intfTimerInterval);

    void connectNetworkReply(QNetworkReply* reply);
//    void connectReplyToErrors(QNetworkReply* reply);
signals:
    void RESTReply(const QByteArray ba);
private:
    APIBase *base;
    QList<QTimer *> timers;

    // url 对应 EquipMark   < "https://jsonplaceholder.typicode.com" ,"xxx-xxx1" >
    QMap <QString ,QString> UrlEquipMarkMap;
};

#endif // REST_H
